home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Jan 2, 2000
- // Author: bb
- //
- // Description:
- // This script is the export character map option box dialog.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
- proc setOptionVars (int $forceFactorySettings)
- {
- // characterMapMethod:
- // 1: by attr name
- // 2: by attr order
- // 3: by node name
- // 4: using existing mapping
- //
- if ( $forceFactorySettings || !`optionVar -exists characterMapMethod`) {
- optionVar -intValue characterMapMethod 3;
- }
-
- }
-
- //
- // Procedure Name:
- // characterMapSetup
- //
- // Description:
- // Update the state of the option box UI to reflect the option values.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI.
- // Required so that UI object names can be
- // successfully resolved.
- //
- // forceFactorySettings - Whether the option values should be set to
- // default values.
- //
- // Return Value:
- // None.
- //
- global proc characterMapSetup (string $parent, int $forceFactorySettings)
- {
- // Retrieve the option settings.
- setOptionVars( $forceFactorySettings );
-
- setParent $parent;
-
- // Set the correct radio button.
- int $whichMethod = `optionVar -query characterMapMethod`;
- switch($whichMethod) {
- case 1:
- radioButtonGrp -e -sl 1 byAttrNameMethod;
- break;
- case 2:
- radioButtonGrp -e -sl 1 byAttrOrderMethod;
- break;
- case 3:
- radioButtonGrp -e -sl 1 byNodeNameMethod;
- break;
- case 4:
- radioButtonGrp -e -sl 1 byCurrentMapMethod;
- break;
- default:
- radioButtonGrp -e -sl 1 byAttrNameMethod;
- break;
- }
-
- }
-
- //
- // Procedure Name:
- // characterMapCallback
- //
- // Description:
- // Update the option values with the current state of the option box UI.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI. Required so
- // that UI object names can be successfully resolved.
- //
- // doIt - Whether the command should execute.
- //
- // Return Value:
- // None.
- //
- global proc characterMapCallback (string $parent, int $doIt)
- {
- setParent $parent;
-
- if (`radioButtonGrp -q -sl byAttrNameMethod` == 1) {
- optionVar -intValue characterMapMethod 1;
- } else if (`radioButtonGrp -q -sl byAttrOrderMethod` == 1) {
- optionVar -intValue characterMapMethod 2;
- } else if (`radioButtonGrp -q -sl byCurrentMapMethod` == 1) {
- optionVar -intValue characterMapMethod 4;
- } else {
- optionVar -intValue characterMapMethod 3;
- }
-
- if ($doIt)
- performExportCharacterMap false;
- }
-
-
- proc string characterMapWidgets( string $parent )
- {
- setParent $parent;
-
- string $tabForm = `columnLayout -adj true`;
-
- // how to do the export
- radioButtonGrp -numberOfRadioButtons 1
- -select 1
- -label "Map Method"
- -label1 "By Attribute Name"
- byAttrNameMethod;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "By Attribute Order"
- -shareCollection byAttrNameMethod
- byAttrOrderMethod;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "By Node Name"
- -shareCollection byAttrNameMethod
- byNodeNameMethod;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label1 "By Current Map"
- -shareCollection byAttrNameMethod
- byCurrentMapMethod;
-
- return $tabForm;
- }
-
- global proc characterMapOptions ()
- {
- string $commandName = "characterMap";
-
- // Build the option box "methods"
- //
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- // Get the option box.
- //
- // The value returned is the name of the layout to be used as
- // the parent for the option box UI.
- //
- string $layout = getOptionBox();
- setParent $layout;
-
- setOptionBoxCommandName("characterMap");
-
- setUITemplate -pushTemplate DefaultTemplate;
- waitCursor -state 1;
- tabLayout -scr true -tv false; // To get the scroll bars
-
- string $parent = `columnLayout -adjustableColumn 1`;
-
- characterMapWidgets $parent;
-
- waitCursor -state 0;
- setUITemplate -popTemplate;
-
- // 'Apply' button.
- //
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit
- -label "Export"
- -command ($callback + " " + $parent + " " + 1)
- $applyBtn;
-
- // 'Save' button.
- //
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
- $saveBtn;
-
- // 'Reset' button.
- //
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- // Set the option box title.
- //
- setOptionBoxTitle("Export Character Map Options");
-
- // Customize the 'Help' menu item text.
- //
- setOptionBoxHelpTag( "ExportCharacterMap" );
-
- // Set the current values of the option box.
- //
- eval (($setup + " " + $parent + " " + 0));
-
- // Show the option box.
- //
- showOptionBox();
- }
-
-
- //
- // Procedure Name:
- // assembleCmd
- //
- // Description:
- // Construct the command that will apply the option box values.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- proc string assembleCmd()
- {
- string $cmd;
-
- setOptionVars(false);
-
- string $mapMethod = "byAttrName";
- int $whichMethod = `optionVar -q characterMapMethod`;
- switch ($whichMethod) {
- case 1:
- $mapMethod = "byAttrName";
- break;
- case 2:
- $mapMethod = "byAttrOrder";
- break;
- case 3:
- $mapMethod = "byNodeName";
- break;
- case 4:
- $mapMethod = "currentMap";
- break;
- }
-
- // doExportCharacterMapArgList takes a string array
- //
- $cmd = "doExportCharacterMapArgList 2 { " +
- "\"" + $mapMethod + "\"" +
- " };";
-
- return $cmd;
- }
-
- //
- // Procedure Name:
- // performExportCharacterMap
- //
- // Description:
- // Post a window with the export character map options or assemble
- // a string corresponding to the character map command.
- //
- //
- // Input Arguments:
- // 0 - Execute the command.
- // 1 - Show the option box dialog.
- // 2 - Return the command.
- //
- // Return Value:
- // None.
- //
- global proc string performExportCharacterMap(int $action)
- {
- string $cmd = "";
-
- switch ($action) {
-
- // Execute the command.
- //
- case 0:
- // Retrieve the option settings
- //
- setOptionVars(false);
-
- // Get the command.
- //
- $cmd = `assembleCmd`;
-
- // Execute the command with the option settings.
- //
- if ($cmd != "")
- evalEcho($cmd);
- break;
-
- // Show the option box.
- //
- case 1:
- characterMapOptions;
- break;
- case 2:
- // Get the command.
- //
- $cmd = `assembleCmd`;
- }
- return $cmd;
- }
-
-